<?php
namespace app\admin\model;

class UserActivity extends \think\Model {

    public function getSexStrAttr($val, $data){
        $arr = ['男', '女'];
        return $arr[$data['sex']];
    }
    public function getIsSignOnStrAttr($val, $data){
        $arr = ['未签到', '已签到'];
        $res_str = $arr[$data['is_sign_on']];
        $data['is_sign_on'] && $res_str .= ' (于'.date('Y-m-d H:i:s', $data['sign_on_time']).')';
        return $res_str;
    }
    public function getIsSignOffStrAttr($val, $data){
        $arr = ['未签退', '已签退'];
        $res_str = $arr[$data['is_sign_off']];
        $data['is_sign_off'] && $res_str .= ' (于'.date('Y-m-d H:i:s', $data['sign_off_time']).')';
        return $res_str;
    }
    public function getBirthdayStrAttr($val, $data){
        return date('Y-m-d', $data['birthday']);
    }

}